#!/bin/bash

source etc/mod_busconsole.conf

#####################
## CLEARING SYSTEM ##
#####################

OLD_BUSCONSOLE_SOCKET=`netstat | grep casper | tr -s ' ' | cut -d' ' -f7`
if [ -n "${OLD_BUSCONSOLE_SOCKET}" -a -e "${OLD_BUSCONSOLE_SOCKET}" ]; then
	log INFO "found old busconsole socket: ${OLD_BUSCONSOLE_SOCKET}. Removing..."
	rm ${OLD_BUSCONSOLE_SOCKET}
fi

if [ -n "${CASPER_BUSCONSOLE_SOCKET}" -a -e "${CASPER_BUSCONSOLE_SOCKET}" ]; then
	log INFO "busconsole socket already exists: removing..."
	rm ${CASPER_BUSCONSOLE_SOCKET}
fi

#######################
## SETTING VARIABLES ##
#######################

echo variables set CASPER_BUSCONSOLE_SOCKET ${CASPER_BUSCONSOLE_SOCKET}
